<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<script>
function fnUpload(){
	var filePath = document.getElementById("bulk_questions").value.toUpperCase();	
	if((filePath.length - filePath.indexOf(".XLS"))==4 ){		
		window.document.questionForm.action = '/uploadQuestionFile.do';
		window.document.questionForm.submit();
	}
	else{
		alert("Only Micorsoft Excel file can be uploaded");
		return;
	}
}
</script>
<html:form action="/uploadQuestionFile" enctype="multipart/form-data">
<%String linktab = (String)request.getAttribute("selectedTab"); %>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
	    <td>
	    	<table width="700px" border="0" cellspacing="0" cellpadding="0">
	  			<tr>
					<%if("CREATE".equalsIgnoreCase(linktab)) {%>
				    <td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("createLink")%>">Create</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else {%>
					<td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("createLink")%>">Create</a></div></td>
				    <td class="inactiveTabc2"></td>
					<%}%>
				    <td class="spacer"></td>
					<%if("EDIT".equalsIgnoreCase(linktab)) {%>
					<td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("editLink")%>">Edit</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else{%>
				    <td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("editLink")%>">Edit</a></div></td>
				    <td class="inactiveTabc2"></td>
					<%}%>
				    <td class="spacer"></td>
					<%if("VIEW".equalsIgnoreCase(linktab)) {%>
					<td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("viewLink")%>">View</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else{%>
				    <td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("viewLink")%>">View</a></div></td>
				    <td class="inactiveTabc2"></td> 
					<%}%>
					<td class="spacer"></td>
					<%if("UPLOAD".equalsIgnoreCase(linktab)) {%>
					<td class="activeTabc1"></td>
				    <td class="activeTabbg"><div align="center" class="style10"><a href="<%=request.getAttribute("uploadLink")%>">Upload</a></div></td>
				    <td class="activeTabc2"></td>
					<%} else{%>
				    <td class="inactiveTabc1"></td>
				    <td class="inactiveTabbg"><div align="center" class="style11"><a href="<%=request.getAttribute("uploadLink")%>">Upload</a></div></td>
				    <td class="inactiveTabc2"></td>
					<%}%>
	  			</tr>
			</table>
		</td>
  	</tr>
  	<tr>
    	<td class="formbg" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  	<tr>
    	<td>
    		<table width="100%" border="0" cellspacing="4" cellpadding="0">
		<tr>
		<td>&nbsp;</td>			
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		</tr>
	<tr>
		<td id="msg" colspan="5"><jsp:include page="showErrorMessage.jsp"/></td>
	</tr>
	<tr>
		<td>
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td>&nbsp;</td>
					<td class="formText">File Name</td>
					<td valign="middle"><html:file property="bulk_questions" styleId="bulk_questions" styleClass="formfile"/></td>
					<td valign="middle"><a href="/downloadTemplate.do"><img src="images/download_template.jpg" alt="Download Template"/></a></td>
				</tr>
				<tr>
					<td height="25" colspan="4" align="center" valign="top">&nbsp;</td>
				</tr>
				<tr>
					<td height="25" colspan="4" align="center" valign="top">
						<input type="button" class="imageButton" value="Upload" onClick="javascript:fnUpload()">
					</td>
				</tr>
			</table>
			</td>
		</tr>
	</table>
	</td>
</tr>
</table>

</html:form>
